Access textbox on button click event

Hi, I need to access a textbox's text in the click event of a button. I can't figure out what to do. Here is my code...
 

void fnPrint(DB dialog) 
{
    //Print what is in the textbox
} 
 
DB dbDialog = create "Input"
DBE txtBox = text(dbDialog, "Input: ", "", 100, false)
DBE button(dbDialog, "Submit", fnPrint)
realize dbDialog
show dbDialog

joeyvitoro - Wed Mar 07 13:41:13 EST 2012

Re: Access textbox on button click event
llandale - Wed Mar 07 17:21:27 EST 2012

[1] You gotta declare many of the DBEs as global parameters, so you might as well routinely define all of them up front.
[2] A "button" requires a callback with a DBE parameter, an "apply" or "ok" takes a "DB" parameter.

DB dbDialog
DBE txtBox, dbeSubmit
 
void fnPrint(DBE dbeXX) 
{   string Text = get(txtBox)
    infoBox("Input parameter is dbeSubmit = " (dbeXX == dbeSubmit) "\n" Text)
 
} 
 
dbDialog = create "Input"
txtBox = text(dbDialog, "Input: ", "", 100, false)
dbeSubmit = button(dbDialog, "Submit", fnPrint)
realize dbDialog
show dbDialog


{code}
-Louie

Some folks have devised a clever scheme of storing DBE parameters into a single global Skip list. I suppose that could be necissary if your code has a variable number of available Dialogs it can display, and also some of the DBEs are shared between the dialogs. I've never had a problem declaring all my DB and DBEs as globals, even for my massive scripts.

Re: Access textbox on button click event
joeyvitoro - Fri Mar 09 11:01:16 EST 2012

Thanks!